
/**
 * @file        main.cpp
 * @author      OuYang
 * @date        2025/05/06
*/


#include "mainwindow.h"
#include <QApplication>
#include <QFile>



int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    // set icon
    a.setWindowIcon(QIcon(":/icon/logo.png"));

    // set style
    QFile qss(":/style/stylesheet.qss");
    if (!qss.open(QFile::ReadOnly)) {
        qDebug("Style load faild!!!");
    }
    QString style = QLatin1String(qss.readAll());
    a.setStyleSheet(style);
    qss.close();

    // set url prefix
    QString fileName = "config.ini";
    QString app_path = QCoreApplication::applicationDirPath();
    QString config_path = QDir::toNativeSeparators(app_path + QDir::separator() + fileName);
    QSettings settings(config_path, QSettings::IniFormat);
    QString gate_host = settings.value("GateServer/host").toString();
    QString gate_port = settings.value("GateServer/port").toString();
    gate_url_prefix = "http://" + gate_host + ":" + gate_port;

    MainWindow w;
    w.show();
    return a.exec();
}
